home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / TCL1 / GRAPH_FO / ZOOMRECT.C < prev   
Text File  |  1991-01-06  |  1KB  |  39 lines

  1. /******************************************************************************
  2.     ZoomRect.c
  3.  
  4.     Taken from The Essential MacTutor Vol. 3, p.140 & 614
  5. *******************************************************************************/
  6. ZoomRect(srect, drect, expand, delay)
  7. Rect *srect; Rect *drect; Boolean expand; long delay; {
  8.     GrafPtr        savePort, deskPort;
  9.     Rect        r[17];
  10.     long        unit, ticks;
  11.     int            count;
  12.     PenState    ps;
  13.  
  14.     GetPort(&savePort);
  15.     GetWMgrPort(&deskPort);
  16.     SetPort(deskPort);
  17.     GetPenState(&ps);
  18.     PenMode(notPatXor);
  19.     PenPat(gray);
  20.     for(count = 0; count < 22; count ++) {
  21.         Delay(delay, &ticks);
  22.         if(count < 16) {
  23.             r[count] = *srect;
  24.             unit = (expand?count+1:33-count)*count/2;
  25.             r[count].top += (unit*(drect->top - srect->top))/136;
  26.             r[count].left += (unit*(drect->left - srect->left))/136;
  27.             r[count].bottom += (unit*(drect->bottom - srect->bottom))/136;
  28.             r[count].right += (unit*(drect->right - srect->right))/136;
  29.             FrameRect(&r[count]);
  30.             }
  31.         if(count >= 6)
  32.             FrameRect(&r[count - 6]);
  33.         }
  34.     SetPenState(&ps);
  35.     SetPort(savePort);
  36.     }
  37.  
  38.  
  39.